* Firm organization with multiple establishments
* Appendix A: Table A.20

clear all 
set matsize 2000
set more off

capture log close
log using log/30_facts-p_org_layer-firm.log, replace

use "data/Org_2000-2010_p_layer-firm.dta", clear
count

qui tab jahr, gen(d_jhr)
gen ln_prdt_wkr_unt = log(prdt_wkrs_unt)

********************************************************************************
***	Firm-level analyses	********************************************************
********************************************************************************

duplicates report untid jahr
cap drop d_mbu
gen d_mbu = (count_est > 1)
tab d_mbu, missing

estimates clear

gen shr_mgmt_w_unt_glm = shr_mgmt_w_unt / 100
sum shr_mgmt_w_unt_glm
label variable shr_mgmt_w_unt_glm "Managerial share in wage sum, layer"

gen shr_bloss_w_unt_glm = shr_bloss_w_unt / 100
sum shr_bloss_w_unt_glm
label variable shr_bloss_w_unt_glm "Managerial share in wage sum, Blossfeld"


global FEunt93	"d_93wz* d_hq_kreis* d_legal* d_jhr*" // d_93wz bezieht sich auf HQ Sektor
global optMEcount	"vce(cluster hq_kreis)"
global optGLM		"link(logit) family(binomial) nolog"
global opttab		"b(%9.3f) star(+ 0.10 * 0.05 ** 0.01 *** 0.001) compress mtitles style(tex) label"

********************************************************************************
***	Table A.20: Mg. organization of firm ******************************************

eststo col1, title("\# layers"): qui poisson count_mgmt_unt d_mbu					$FEunt93, $optMEcount
eststo col2, title("\# layers"): qui poisson count_mgmt_unt d_mbu ln_sales  		$FEunt93, $optMEcount
eststo col3, title("\# layers"): qui poisson count_mgmt_unt d_mbu ln_prdt_wkr_unt	$FEunt93, $optMEcount

eststo col4, title("Mg.share"): qui glm shr_mgmt_w_unt_glm d_mbu				 	$FEunt93, $optGLM $optMEcount

eststo col5, title("Mg.share"): qui glm shr_bloss_w_unt_glm  d_mbu					$FEunt93, $optGLM $optMEcount

esttab col1 col2 col3 col4 col5, ///
	$opttab se(%9.3f) indicate($FEunt93, labels(Y N)) drop(o.*) order(d_mbu ln_sales ln_prdt_wkr_unt)
esttab col1 col2 col3 col4 col5, ///
	$opttab p(%9.3f)  indicate($FEunt93, labels(Y N)) drop(o.*) order(d_mbu ln_sales ln_prdt_wkr_unt)


log close
